import axios from 'axios'
import { request} from '@/utils/request';
import { request_t,instance} from '@/utils/request2';
import cache from '@/utils/cache';
//登录
export function Login(data) {
    const url = request.baseURL + '/api/user/Auth/Login';
    return axios.post(url, data).then((res) => {
        return Promise.resolve(res.data);
    });
};


//注册
export function Register(data) {
    const url = request.baseURL + '/api/user/Auth/Register';
    return axios.post(url, data).then((res) => {
        return Promise.resolve(res.data);
    });
};



//找回密码
export function Findpwd(data) {
    const url = request.baseURL + '/api/user/Auth/Findpwd';
    let res=request_t(url, 'post', data)
    return res
};
//更换手机号
export function ModifyPhone(id,phone,smscode) {
    const data = {
        phone: phone,
        smscode: smscode
    };
    const url ='/api/user/Auth/ModifyPhone';
    let res=request_t(url, 'post', data)
    return res
};
//重置密码
export function ModifyPwd(oldpwd,newpwd) {
    const data = {
        oldpwd: oldpwd,
        newpwd: newpwd
    };
    const url ='/api/user/Auth/ModifyPwd';
    let res=request_t(url, 'post', data)
    return res
};
//更换邮箱
export function ModifyEmail(email) {
    const data = {
        email: email,
    };
    let res = request_t('/api/user/Auth/ModifyEmail', 'post', data)
    return res
};
//身份证认证
export function IdentityAuthentication(data) {
    const url ='/api/user/Auth/IdentityAuthentication';
    let res=request_t(url, 'post', data)
    return res
};
//安全中心初始状态InitialState
export function InitialState() {
    const url ='/api/user/Auth/InitialState';
    let res=request_t(url, 'get', {})
    return res
};
// 更换头像ChageAvatar
export function ChageAvatar(avatar) {
    const data={
        avatar:avatar
    };
    const url ='/api/user/Auth/ChageAvatar';
    let res=request_t(url, 'post', data)
    return res
};

